import { Modal } from 'antd'
const confirm = Modal.confirm
const title = {
  info:"信息提示",
  success:"成功提示",
  error:"错误提示",
  warning:"警告提示",
  confirm:"确认",
  okText:"确定",
  cancelText:"取消"
}
export const ModalMessage = {
  info(content: string) {
    Modal.info({ title: title.info, content: content, okText: title.okText })   
  },
  success(content: string) {
    Modal.success({ title: title.success, content: content, okText: title.okText })   
  },
  error(content: string) {
    Modal.error({ title: title.error, content: content, okText: title.okText })   
  },
  warning(content: string) {
    Modal.warning({ title: title.warning, content: content, okText: title.okText })   
  },
  confirm(content: string, onOk?: Function, onCancel?: Function){
    confirm({
      title: title.confirm,
      content: content||'你确定要执行该操作吗？',
      okText: title.okText,
      okType: 'danger',
      cancelText: title.cancelText,
      onOk() {
        if(onOk) onOk()
      },
      onCancel() {
        if(onCancel) onCancel()
      },
    })
  },
}